package com.binson.apppay.exception.fallback;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.binson.common.core.domain.R;
import com.binson.common.model.AppModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;

@Slf4j
@Component
public class MyExceptionUtil {

    public  R handleException(String s, BlockException ex) {
        // Do some log here.
//        ex.printStackTrace();
        System.out.println("被限流，无法访问接口");
        log.error("某个内容被限流了");
        return R.fail("被限流，无法访问接口");
    }
    public  R payfallback(@RequestBody AppModel appModel, BlockException ex) {
        System.out.println("熔断功能被开启");
        return  R.fail(appModel,"pay 熔断功能被开启");
    }


}
